#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <omp.h>

#define ceild(n,d)  ceil(((double)(n))/((double)(d)))
#define max(x,y)    ((x) > (y)? (x) : (y))
#define min(x,y)    ((x) < (y)? (x) : (y))
#define myabs(x,y)  (((x) > (y))? ((x)-(y)) : ((y)-(x)))



#define  kernel(A) A[(t+1)%2][x][y][z] =  0.125*(A[t%2][x - 1][y][z] - 2.0 * A[t%2][x][y][z] + A[t%2][x + 1][y][z])\
										+ 0.125*(A[t%2][x][y - 1][z] - 2.0 * A[t%2][x][y][z] + A[t%2][x][y + 1][z])\
										+ 0.125*(A[t%2][x][y][z - 1] - 2.0 * A[t%2][x][y][z] + A[t%2][x][y][z + 1])\
										+ A[t%2][x][y][z];

#define  kernel_t(A,t) A[((t)+1)%2][x][y][z] =  0.125*(A[(t)%2][x - 1][y][z] - 2.0 * A[(t)%2][x][y][z] + A[(t)%2][x + 1][y][z])\
										+ 0.125*(A[(t)%2][x][y - 1][z] - 2.0 * A[(t)%2][x][y][z] + A[(t)%2][x][y + 1][z])\
										+ 0.125*(A[(t)%2][x][y][z - 1] - 2.0 * A[(t)%2][x][y][z] + A[(t)%2][x][y][z + 1])\
										+ A[(t)%2][x][y][z];					 

#define  kernel_xxyy(A,t)  A[(t+1)%2][x + xx][y + yy][z] =  0.125*(A[t%2][x + xx - 1][y + yy][z] - 2.0 * A[t%2][x + xx][y + yy][z] + A[t%2][x + xx + 1][y + yy][z])\
										+ 0.125*(A[t%2][x + xx][y + yy - 1][z] - 2.0 * A[t%2][x + xx][y + yy][z] + A[t%2][x + xx][y + yy + 1][z])\
										+ 0.125*(A[t%2][x + xx][y + yy][z - 1] - 2.0 * A[t%2][x + xx][y + yy][z] + A[t%2][x + xx][y + yy][z + 1])\
										+ A[t%2][x + xx][y + yy][z];	

#define XSLOPE 1
#define YSLOPE 1
#define ZSLOPE 1
#define XSTART 4
#define YSTART 4
#define ZSTART 4
#define DATA_TYPE double

